#include<bits/stdc++.h>
using namespace std;

void quickSort(vector<int>& nums,int left,int right){
    if(left>right){
        return;
    }
    int first=left;
    int last=right;
    int key=nums[left];
    while(first<last){ 
        while(first<last && nums[last]>=key){
            --last;
        }
        nums[first]=nums[last];
        while(first<last && nums[first]<key){
            ++first;
        }
        nums[last]=nums[first];
    }
    nums[first]=key;
    quickSort(nums,left,first-1);
    quickSort(nums,first+1,right);
}

int main(int argc, char const *argv[])
{
    vector<int> nums={9,6,4,5,2,33,45,-9};
    quickSort(nums,0,nums.size()-1);
    for(auto i:nums){
        cout<<i<<" ";
    }
    return 0;
}
